
const { DataTrack, UserInfo } = require("./index.js");

const ctx =  {
  'platform': 'taobao11',
  'env': 'node',
  'mixNick': 'z01IE98JVR+EUTRXq0dG0i0pTix+Oonf5VD0dnSUq8vAJo=',
  'data': {
    projectCode: "102",
    province: "",
    city: "",
    customType: "",
    origin: "miniApp",
  },
  'cloud': {},
  'mfUtil': {"dbpattern":"mongo","db":{"mongo":{"find":()=>{}}}}
}


// 埋点
let dataTrack = new DataTrack(ctx);

let obj = {
  version: "v2",
  projectCode: "102",
  timestamp: new Date().getTime().toString(),
  province: "",
  city: "",
  customType: "",
  origin: "miniapp",
  userid: "天亮向你说晚安",
  type: "flowSource"
}

//  pv uv埋点
dataTrack.puuv(obj).then(data=>{
  console.log("#####   dataTrack.pvuv   :", data);
});

let obj2 = {
  version: "v2",
  projectCode: "102",
  timestamp: new Date().getTime().toString(),
  province: "",
  city: "",
  customType: "flowSource",
  origin: "miniapp",
  userid: "天亮向你说晚安",
  type: ""
}
//  自定义埋点
dataTrack.custom(obj2).then(data=>{
  console.log("######   dataTrack.custom   :", data);
});



// 用户
let userInfo = new UserInfo(ctx);

userInfo.insertUserRecord().then(data=>{
  console.log("insertUserRecord~~~~~~", data);
});

